#pragma once
#include<stdio.h>
#include<string.h>
#include<unistd.h>
#include<sys/types.h>
#include<sys/stat.h>
#include<fcntl.h>
#include<stdlib.h>
#include<assert.h>

#define FILE_MODE 0666 //创建文件权限
#define SIZE 1024

#define FLUSH_NON 1 //无缓冲
#define FLUSH_LINE 2    //行缓冲
#define FLUSH_ALL 4 //全缓冲

typedef struct IO_FILE
{
    int fileno;//文件描述符fd

    char outbuffer[SIZE];//输出缓冲区
    int flag;//刷新策略
    int out_pos;//缓冲区指针，指向缓冲区最后一个字符'\0'

}_FILE;

_FILE* _fopen(const char* path,const char* mode);
void _fclose(_FILE* fp);
int _fwrite(const char* msg,int size,_FILE* fp);

